package game;

import java.awt.Font;
import java.io.InputStream;

public class LoadFonte
{
	private static Font[] fontes;
	private static LoadFonte instance;
	private String[][] stFonte = new String[][]
	{ 
			{"/fontes/FonteRecife.ttf", "13"},
			{"/fontes/FonteRecife.ttf", "30"},
			{"/fontes/FonteRecife.ttf", "60"},
	};
	
	public void Load()
	{
		fontes = new Font[stFonte.length];
		
		
		
		
		for(int i = 0; i < stFonte.length; i++)
		{
			fontes[i] = getFonte2(Integer.parseInt(stFonte[i][1]), stFonte[i][0]);
		}
		
	}
	
	private LoadFonte(){}
	
	public static LoadFonte getInstance(){
		if(instance == null)
			instance = new LoadFonte();
		
		return instance;
	}
	
	public static Font getFonte(int index)
	{
		return fontes[index];
	}
	
	private Font getFonte2(int tamanho, String caminho)
	{  
	      Font font = null;  
	      
	      try{  
	    	  
	         //File file = new File( caminho );  
	         InputStream fis = LoadFonte.class.getResourceAsStream(caminho);
	         font = Font.createFont( Font.TRUETYPE_FONT, fis); 
	         
	         
	      }catch( Exception e )
	      {  
	         //System.out.println( e.getMessage() );  
	      }  
	      font = font.deriveFont(Font.PLAIN, tamanho);  
	      return font;  
	} 
}